$OpenBSD: patch-src_session_download_c,v 1.1 2011/08/03 12:51:24 edd Exp $

bug 869: fix a buffer overflow segfault in do_type_query
http://bugzilla.elinks.cz/show_bug.cgi?id=869

--- src/session/download.c.orig	Sat Aug 22 12:15:08 2009
+++ src/session/download.c	Wed Aug  3 01:14:40 2011
@@ -1090,10 +1090,7 @@ do_type_query(struct type_query *type_query, unsigned 
 		}
 
 		if (handler && handler->program) {
-			int programlen = strlen(handler->program);
-
-			programlen = int_max(programlen, MAX_STR_LEN);
-			memcpy(field, handler->program, programlen);
+			safe_strncpy(field, handler->program, MAX_STR_LEN);
 		}
 
 		/* xgettext:no-c-format */
